package com.naodong.shenluntiku.mvp.model.bean;

import android.support.annotation.Nullable;

import com.google.gson.Gson;

import net.orange_box.storebox.adapters.base.BaseStringTypeAdapter;

/**
 * Created by hujie on 17/5/22.
 */


public class TokenTypeAdapter extends BaseStringTypeAdapter<Token> {

    @Nullable
    @Override
    public String adaptForPreferences(@Nullable Token value) {
        return new Gson().toJson(value);
    }

    @Nullable
    @Override
    public Token adaptFromPreferences(@Nullable String value) {
        return new Gson().fromJson(value, Token.class);
    }

    public TokenTypeAdapter(){
        super();
    }
}